# coding: utf-8
import webapp2
import jinja2
import os
from settings import STATIC_PATH

jinja_environment = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname("templetes/")))


class MainPage(webapp2.RequestHandler):
    def get(self):
        keyword = self.request.get('keyword')       # required
        area = self.request.get('area')             # not required, default *
        providerid = self.request.get('providerid')     # not required, default *
        start = self.request.get('start')           # not required, default 0
        expired = self.request.get('expired')       # not required, default 1
        
        # for html output
        template = jinja_environment.get_template("today_coupon.html")
        
        self.response.out.write(template.render({
                                                 "menu_name" : "today_coupon",
                                                 "static_path" : STATIC_PATH,
                                                 "keyword": keyword, 
                                                 "area": area, 
                                                 "provider": providerid, 
                                                 "start": start, 
                                                 "expired": expired}))
        
app = webapp2.WSGIApplication([('/today_coupon', MainPage)], debug=True)